<template>
  <div class="adminHeader">
      <div class="adminHeader-left" >
        <span style="cursor: pointer" @click="toAdminBackground">佛山市小布村管理平台</span>

      </div>
      <div class="adminHeader-right">
        <el-dropdown>
          <span class="el-dropdown-link">
            <el-avatar icon="el-icon-user-solid" size="small"></el-avatar>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item @click.native="adminLogout">退出系统</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
  </div>
</template>

<script>
export default {
  data() {
    return{
      admin:'',
    }
  },
  created() {
    this.admin = JSON.parse(window.localStorage.getItem('access-admin'))
  },
  methods:{
    adminLogout() {
      this.$router.push({path:'/'})
      //退出登陆，清空token
      localStorage.removeItem('access-admin');
      this.$router.push({path:'/'})
    },
    toAdminBackground() {
      this.$router.push({
        name: "adminBackground",
      });
    }
  }

}
</script>

<style lang="less" scoped>

.adminHeader {
  display: flex;
  width: 100%;
  height: 50px;
  background-color: #6b9eef;
  justify-content: space-between;
  align-items: center;
  padding-left: 30px;

    .adminHeader-left{
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 80%;
      font-size: 20px;
    }

    .adminHeader-right {
      display: flex;
      justify-content: space-between;
      align-items: center;
      width: 5%;
    }


}

</style>